package com.frank.feignDecoder.config;

import feign.Logger;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import feign.codec.Decoder;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.cloud.openfeign.support.SpringDecoder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 小石潭记
 * @date 2021/3/8 11:01
 * @Description: ${todo}
 */
public class BusinessConfig implements RequestInterceptor {
    @Autowired
    private ObjectFactory<HttpMessageConverters> messageConverters;
    @Bean
    public Decoder decoder() {
        return new SpringDecoder(messageConverters);
    }
    @Bean
    public Logger.Level getLevel() {
        return Logger.Level.FULL;
    }
    @Override
    public void apply(RequestTemplate requestTemplate) {
        // todo 添加请求头的信息
    }
}
